<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml"
      xmlns:ui="http://java.sun.com/jsf/facelets"
      xmlns:h="http://java.sun.com/jsf/html"
      xmlns:p="http://primefaces.org/ui"
      xmlns:f="http://java.sun.com/jsf/core">

    <body>

        <ui:composition >

            <p:panel >
                <h:panelGrid columns="2" >
                    <p:commandButton id="btnSalvar" 
                                     value="Salvar F10" 
                                     icon="iconSalvar"
                                     action="#{criancaBean.salvar()}"
                                     update=":geral,:geral:mensagem, :geral:pnlProcesso"
                                     />
                    <p:commandButton value="Voltar Esc"
                                     id="btnVoltar"
                                     action="#{criancaBean.voltar()}"
                                     icon="iconFechar"
                                     update=":geral:pnlProcesso, :geral:mensagem"/>
                </h:panelGrid>
            </p:panel>


            <h:panelGrid columns="2">
                
                
                <h:outputLabel value="Nome: *"/>
                <p:inputText value="#{criancaBean.crianca.nome}" label="Nome" size="46" />

                <h:outputLabel value="Responsavel: "/>
                <p:autoComplete
                    forceSelection="true"
                    scrollHeight="200" 
                    value="#{criancaBean.crianca.responsavel}" 
                    size="70" 
                    completeMethod="#{responsavelBean.completeResponsavel}"
                    var="responsavel"
                    converter="ResponsavelConversor"
                    itemLabel="#{responsavel.nome}"
                    itemValue="#{responsavel}">
                </p:autoComplete>
                

                <h:outputLabel  value="Sexo: "/>
                <p:selectOneMenu value="#{criancaBean.crianca.sexo}" style="width: 200px; height: auto">
                    <f:selectItem itemLabel="Selecione..." itemValue=""/>
                    <f:selectItem itemLabel="Masculino" itemValue="M"/>
                    <f:selectItem itemLabel="Feminino" itemValue="F"/>
                </p:selectOneMenu>

                <h:outputLabel value="Ambiente: "/>
                <p:autoComplete
                    forceSelection="true"
                    scrollHeight="200" 
                    value="#{criancaBean.crianca.evento}" 
                    size="70" 
                    completeMethod="#{eventoBean.completeEvento}"
                    var="evento"
                    itemLabel="#{evento.nome}"
                    converter="EventoConversor"
                    itemValue="#{evento}">
                    <p:column headerText="Código">
                        <h:outputText value="#{evento.id}"/>
                    </p:column>

                    <p:column headerText="Nome">
                        <h:outputText value="#{evento.nome}"/>
                    </p:column>
                </p:autoComplete>

                <h:outputLabel  value="Data Perdida: "/>
                <p:calendar  value="#{criancaBean.crianca.perdida}" 
                             pattern="dd/MM/yyyy HH:mm"/>

                <h:outputLabel value="Data Encontrada: "/>
                <p:calendar  value="#{criancaBean.crianca.encontrada}" 
                             pattern="dd/MM/yyyy HH:mm"/>

                <h:outputLabel  value="Descrição"/>
                <p:inputTextarea value="#{criancaBean.crianca.descricao}" label="Descriçao" rows="5" cols="40"
                                 queryDelay="150" minQueryLength="4"/>


            </h:panelGrid>

        </ui:composition>

    </body>
</html>
